package com.lagou.service.impI;

import com.lagou.dao.AccountDao;
import com.lagou.domain.Account;
import com.lagou.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import java.util.List;

/**
 * @Author wsl
 * @Date 2021/11/9 6:36
 * @Project_Name jdbc_spring
 */
@Service("accountService") //相当于配置了bean标签 id属性
public class AccountServiceImpI implements AccountService {

    @Autowired//使用在字段上用于根据类型依赖注入
    private AccountDao accountDao;

    //1.查询所有
    public List<Account> findAll() {

        return accountDao.findAll();

    }

    //2.根据id查询
    public Account findById(Integer id) {

        return accountDao.findById(id);
    }

    //3.新增操作
    public void save(Account account) {

        accountDao.save(account);

    }

    //4.修改操作
    public void update(Account account) {

        accountDao.update(account);

    }

    //5.删除操作
    public void delete(Integer id) {

        accountDao.delete(id);

    }

}
